﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.Web;
using System.ComponentModel;

namespace coolGrid
{
    public class coolGridView : GridView
    {
        public coolGridView()
        {
            GerarTagsSeparadoras = false;
        }

        [Description("Quando true, faz a geração das tags THEAD, TBODY e TFOOT para a gridview")]        
        public bool GerarTagsSeparadoras
        {
            get;
            set;
        }

        protected override void OnPreRender(EventArgs e)
        {
            if (GerarTagsSeparadoras)
            {
                if (this.HeaderRow != null)
                    this.HeaderRow.TableSection = TableRowSection.TableHeader;

                if (this.TopPagerRow != null)
                    this.TopPagerRow.TableSection = TableRowSection.TableHeader;

                if (this.BottomPagerRow != null)
                    this.BottomPagerRow.TableSection = TableRowSection.TableFooter;

                if (this.FooterRow != null)
                    this.FooterRow.TableSection = TableRowSection.TableFooter;
            }
            
            base.OnPreRender(e);
        }
    }
}
